<?php


namespace App\Http\Controllers\WebApi\Business;


use App\Models\ImOperationLogs;
use Illuminate\Support\Facades\Route;

class OperationLogsBusiness
{
    /**
     * 写入操作日志
     * @param $type 类型
     * @param $desc 描述
     */
    public static function addLog($type, $desc = '')
    {
        $logs = new ImOperationLogs();
        $logs->type = $type;
        $logs->operator = request()->userInfo['id'];
        $logs->ip = request()->getClientIp();
        $logs->uri = Route::current()->uri();
        $logs->description = $desc;
        $logs->save();
    }
}
